class ApiResponse<T>{
  final T? data;
  final int code;
  final String message;
  final bool success;

  ApiResponse({
    required this.success,
    this.data,
    this.message='',
    this.code = 0
});

  factory ApiResponse.froJson(
      Map<String,dynamic> json,
      T Function(dynamic) fromJsonT
      ){
    return ApiResponse<T>(
      success: json['success']?? false,
      code: json['code']??0,
      message: json['message']??'',
      data: json['data']!=null?fromJsonT(json['data']):null,
    );
  }
}